<%--
  Created by IntelliJ IDEA.
  User: 11200
  Date: 2019/8/23
  Time: 上午 11:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<table class="table table-hover ms-table">
  <thead>
  <tr>
    <th>订单号</th>
    <th>创建时间</th>
    <c:if test="${not empty status && status.canShowPaidTime()}">
      <th>支付时间</th>
    </c:if>
    <c:if test="${not empty status && status.canShowCancelTime()}">
      <th>取消时间</th>
    </c:if>
    <c:if test="${not empty status && status.consumed}">
      <th>核销时间</th>
    </c:if>
    <c:if test="${not empty status && status.ticketed}">
      <th>出票时间</th>
    </c:if>
    <th>航空公司</th>
    <th>航班号</th>
    <th>起飞/到达时间</th>
    <th>订单金额</th>
    <th>客户手机</th>
    <th>所属一级代理</th>
    <th class="text-center">操作</th>
  </tr>
  </thead>
  <tbody>

  <c:forEach items="${reverseOrders}" var="ro">
    <tr>
      <td>${ro.code}</td>
      <td><fmt:formatDate value="${ro.createTime}" pattern="yyyy-MM-dd HH:mm"></fmt:formatDate></td>
      <c:if test="${not empty status && status.canShowPaidTime()}">
        <td><fmt:formatDate value="${ro.payTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
      </c:if>
      <c:if test="${not empty status && status.canShowCancelTime()}">
        <td><fmt:formatDate value="${ro.cancelTime}" pattern="yyyy-MM-dd HH:mm"></fmt:formatDate></td>
      </c:if>
      <c:if test="${not empty status && status.consumed}">
        <td><fmt:formatDate value="${ro.consumedTime}" pattern="yyyy-MM-dd HH:mm"></fmt:formatDate></td>
      </c:if>
      <c:if test="${not empty status && status.ticketed}">
        <td><fmt:formatDate value="${ro.ticketTime}" pattern="yyyy-MM-dd HH:mm"></fmt:formatDate></td>
      </c:if>
      <td>${ro.aviationBook.bookAirline}</td>
      <td>往：${ro.aviationBook.flightNumber} 返：${ro.aviationBook.returnFlightNumber}</td>
      <td>
        <fmt:formatDate value="${ro.aviationBook.departureTime}" pattern="yyyy-MM-dd HH:mm"></fmt:formatDate><br>
        <fmt:formatDate value="${ro.aviationBook.arriveTime}" pattern="yyyy-MM-dd HH:mm"></fmt:formatDate>
      </td>
      <td>${ro.prettyPrice}</td>
      <td>${ro.customMobile}</td>
      <td>${not empty ro.primaryAgentCompany ? ro.primaryAgentCompany.name += ro.primaryAgentCompany.companyName : ''}</td>
      <td class="text-center">
        <c:if test="${not empty status && status.editing}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">编辑</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/send-to-client" data-toggle="modal" data-target="#send-to-client">发送客户</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/delete" data-toggle="modal" data-target="#delete">删除</a>
        </c:if>
        <c:if test="${not empty status && status.unpaid}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">编辑</a>&nbsp;&nbsp;
          <c:if test="${ro.canMarkPay()}">
            <a href="${ctx.host}/reverse-orders/${ro.id}/mark-pay" data-toggle="modal" data-target="#mark-pay">标记已支付</a>&nbsp;&nbsp;
          </c:if>
          <a href="${ctx.host}/reverse-orders/${ro.id}/send-message-to-client" data-toggle="modal" data-target="#send-message-to-client">重新发送短信</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/cancel" data-toggle="modal" data-target="#cancel">取消订单</a>&nbsp;&nbsp;
        </c:if>
        <c:if test="${not empty status && status.waitingForTicket}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">编辑</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/reset-price" data-toggle="modal" data-target="#reset-price">改价</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/mark-ticket" data-toggle="modal" data-target="#mark-ticket">标记已出票</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/send-message-to-client" data-toggle="modal" data-target="#send-message-to-client">重新发送短信</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/cancel" data-toggle="modal" data-target="#cancel">取消订单</a>&nbsp;&nbsp;
        </c:if>
        <c:if test="${not empty status && status.ticketed}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">查看</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/reset-price" data-toggle="modal" data-target="#reset-price">改价</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/mark-consumed" data-toggle="modal" data-target="#mark-ticket">标记核销</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/cancel" data-toggle="modal" data-target="#cancel">取消订单</a>&nbsp;&nbsp;
        </c:if>
        <c:if test="${not empty status && status.waitingForRefund}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">查看</a>&nbsp;&nbsp;
          <a href="${ctx.host}/reverse-orders/${ro.id}/mark-refund" data-toggle="modal" data-target="#mark-ticket">标记退款</a>&nbsp;&nbsp;
        </c:if>
        <c:if test="${not empty status && status.canceled}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">查看</a>&nbsp;&nbsp;
        </c:if>
        <c:if test="${not empty status && status.consumed}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">查看</a>&nbsp;&nbsp;
        </c:if>
        <c:if test="${not empty needPay && needPay}">
          <a href="${ctx.host}/reverse-orders/${ro.id}">查看</a>&nbsp;&nbsp;
        </c:if>
      </td>
    </tr>
  </c:forEach>

  </tbody>
  <tfoot>
  <tr>
    <td colspan="14" class="no-vertical-padding">
      <div class="pull-left">
        <jsp:include page="/WEB-INF/include/page.jsp">
          <jsp:param name="url" value="${ctx.host}/reverse-orders"/>
          <jsp:param name="queryString" value="${queryString}"/>
        </jsp:include>
      </div>
    </td>
  </tr>
  </tfoot>
</table>
